package com.cat.bitOperation;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/minimum-number-of-operations-to-make-array-xor-equal-to-k/description/
 * @create 2025/8/20 10:11
 * @since JDK17
 */

public class Solution05 {
    public int minOperations(int[] nums, int k) {
        int xor = 0, n = nums.length;
        for (int i = 0; i < n; i++) {
            xor ^= nums[i];
        }
        return Integer.bitCount(xor ^ k);
    }
}
